Financial Services
Why Nubank built a credit card authorization system on CockroachDB
48M+ customers
CNBC’s 2021 “Disruptor 50”
24M+ credit card users
TIME’s 100 Most Influential Companies
Nubank is a digital bank and financial services company that was born from founder David Vélez’s frustrations with traditional banking companies. Looking at the banking industry in Brazil, Vélez saw inflated lending rates and poor customer service. Nubank was built to do better.
Cutting away a lot of the costs associated with the physical branches of traditional banks, the company was able to launch its first credit card in 2013, barely a year after Vélez founded the startup in São Paulo, Brazil. That card, which had no mandatory fees and offered below-market interest rates, was an instant hit.
Nubank quickly attracted attention both from customers and investors, and within a few years, it had tens of millions of card users and had become the most valuable private digital bank on earth. As the company grew, it was also expanding into markets beyond its native Brazil into Mexico and Argentina in 2019, and Colombia in 2021.
But of course, growing and scaling a global payments company with more than 24 million credit card users (as of 2021) comes with a unique set of technical challenges.
As companies grow, they typically must also evolve their application architecture. Nubank’s initial infrastructure was built with Java Heap using an in-memory data store. For example, the bank’s credit card authorization app – the service that decides whether or not to approve transactions – was spread across four instances of Java Heap, and a Kafka message communicated data changes between the instances.
This worked well initially, but as the bank grew, it became clear that this setup did not scale as well as the team would have liked. It became an increasingly complex transaction environment, and storing data in instances of Java Heap also introduced a lot of operational complexity.
The Nubank team wanted to find something simpler – something that could scale more smoothly and occupy less of their time, so that they could focus on building new features and services for their customers.
Ultimately, the Nubank team decided they wanted a database that:
* Delivers a resilient foundation
* Scales horizontally with ease
* Requires minimal operational upkeep
They evaluated a variety of options, including Cassandra and CouchDB which are known for their ability to scale. However, they needed a database that would be highly available and require minimal operational needs. Ultimately, they found a database that ticked all of their boxes: CockroachDB.
CockroachDB offered everything that Nubank was looking for. Built to support heavy transactional workloads like Nubank’s financial ledger, it achieves strong consistency and guarantees the highest level of isolation, to ensure that Nubank’s data is always correct and accurate.
At the same time, CockroachDB scales automatically. Data is broken into 64-megabyte chunks called ranges that distribute and balance across nodes automatically. If a user wants to add an additional node, he or she simply spins it up and points it at the cluster.
CockroachDB offers strong resiliency, which was also appealing to the Nubank team. Customers expect their credit cards to work all the time, and CockroachDB’s distributed nature made it easy for Nubank’s team to ensure that the loss of a database node, AZ, or region would not lead to any loss of service.
As a bonus, CockroachDB’s familiar SQL interface, which is Postgres wire compatible, meant that it didn’t come with much of a learning curve. Convenient features like automated backups, automated garbage collection, and rolling, no-downtime upgrades freed up Nubank’s developer and infrastructure teams to spend less time worrying about their database and more time working on other projects.
In 2019, Nubank migrated their credit card authorization authorization system to CockroachDB. The team reports that the scalability, ease of use, and resilience have allowed them to spend more time focusing on other aspects of growing Nubank and serving their customers, rather than having to worry about our database.
Today, CockroachDB is the mission-critical database that backs Nubank’s credit card authorization system, serving 24 million (and counting!) cardholders. Nubank’s growth shows no sign of slowing, either.
They are welcoming around 2.1 million new customers per month and have introduced several new product lines. This past summer, the company launched a new premium credit card as well as new investment funds to help its customers diversify their portfolios. Nubank reports that they have saved customers $4.8 billion in bank fees and around 113 million hours in wait time.
Similar to Cockroach Labs, Nubank’s ethos centers around “building for the future”. We are excited to continue to work with the team at Nubank as they change the way we bank in the future!